<!DOCTYPE html>
<html class="x-admin-sm">
<head>
<meta charset="UTF-8">
<title>欢迎页面-X-admin2.2</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
<link rel="stylesheet" href="./css/font.css">
<link rel="stylesheet" href="./css/xadmin.css">
<script type="text/javascript" src="./lib/layui/layui.js"
	charset="utf-8"></script>
<script type="text/javascript" src="./js/xadmin.js"></script>
<!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
<!--[if lt IE 9]>
            <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
            <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
        <![endif]-->
</head>

<body>
<form onsubmit="false">
	<div class="layui-form" style="margin-top: 20px">
		<script type="text/javascript" src="./lib/layui/layui.js"></script>
		<div class="layui-form-item" hidden="tid">
			<label class="layui-form-label">id</label>
			<div class="layui-input-block">
				<input type="text" name="tid" id="tid" autocomplete="off"
					class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">姓名</label>
			<div class="layui-input-block">
				<input type="text" name="tName" id="tName" required
					lay-verify="required" autocomplete="off" class="layui-input"
					style="width: 190px">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">卡号</label>
			<div class="layui-input-block">
				<input type="text" name="tCard" id="tCard" required
					autocomplete="off" class="layui-input" style="width: 190px">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">密码</label>
			<div class="layui-input-block">
				<input type="text" name="tCardPassowrd" id="tCardPassowrd" required
					autocomplete="off" class="layui-input" style="width: 190px">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label"><span style="color: red;">*</span>
				性别</label>
			<div class="layui-input-block" style="width: 190px">
				<select name="tSex" id="tSex">
					<option value=""></option>
					<option>男</option>
					<option>女</option>
				</select>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">年龄</label>
			<div class="layui-input-block">
				<input type="text" name="tAge" id="tAge" required
					lay-verify="required" autocomplete="off" class="layui-input"
					style="width: 190px">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">手机号</label>
			<div class="layui-input-block">
				<input type="text" name="tPhoneNum" id="tPhoneNum" required
					lay-verify="required" autocomplete="off" class="layui-input"
					style="width: 190px">
			</div>
		</div>

		<div class="layui-form-item">
			<div class="layui-input-block">
				  <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
			</div>
		</div>
	</div>
	</form>
	<script type="text/javascript" src="./lib/layui/layui.js"></script>
	<script type="text/javascript">
		layui.use(['form','laydate'], function() {
			var form = layui.form;
			var $ = layui.jquery; //引入jquery
			 var laydate = layui.laydate;
			var layer = layui.layer;

			 form.on('submit(formDemo)', function(data){
		        	var d = {
		        			'tid':$("#tid").val(),
		        			'tName':$("#tName").val(),
				            'tCard':$("#tCard").val(),  
				            'tCardPassowrd':$("#tCardPassowrd").val(),
				            'tSex':$("#tSex").val(),
				            'tAge':$("#tAge").val(),
				            'tPhoneNum':$("#tPhoneNum").val()
				            }
		          var url="/updateTeacher";
		          $.post(url,d,function(res){
		            console.log(res);
		            if(res.count>0){
		              var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
		              parent.layer.close(index); //再执行关闭   
		            }
		          },'json');
		          return false;
		        });

		});
	</script>
</body>

</html>